import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkCouponRecordVO, ParkCouponRecordForm, ParkCouponRecordQuery } from '@/api/park/parkCouponRecord/types';

/**
 * 查询优惠劵记录列表
 * @param query
 * @returns {*}
 */

export const listParkCouponRecord = (query?: ParkCouponRecordQuery): AxiosPromise<ParkCouponRecordVO[]> => {
  return request({
    url: '/park/parkCouponRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询优惠劵记录详细
 * @param couponRecordId
 */
export const getParkCouponRecord = (couponRecordId: string | number): AxiosPromise<ParkCouponRecordVO> => {
  return request({
    url: '/park/parkCouponRecord/' + couponRecordId,
    method: 'get'
  });
};

/**
 * 新增优惠劵记录
 * @param data
 */
export const addParkCouponRecord = (data: ParkCouponRecordForm) => {
  return request({
    url: '/park/parkCouponRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改优惠劵记录
 * @param data
 */
export const updateParkCouponRecord = (data: ParkCouponRecordForm) => {
  return request({
    url: '/park/parkCouponRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除优惠劵记录
 * @param couponRecordId
 */
export const delParkCouponRecord = (couponRecordId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkCouponRecord/' + couponRecordId,
    method: 'delete'
  });
};
